/**@FILE:InviteCodeServiceImpl.java
 * @AUTHOR:qingsheng.zheng
 * @DATE:2015-1-31 下午6:32:13*/
package com.xf.toy.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.xf.pub.exception.ServiceException;
import com.xf.toy.bean.InviteCode;
import com.xf.toy.dao.InviteCodeMapper;
import com.xf.toy.service.InviteCodeService;

/*******************************************
 * @COMPANY:alibaba
 * @CLASS:InviteCodeServiceImpl
 * @DESCRIPTION:	
 * @AUTHOR:qingsheng.zheng
 * @VERSION:v1.0
 * @DATE:2015-1-31 下午6:32:13
 *******************************************/
@Service("inviteCodeService")
public class InviteCodeServiceImpl implements InviteCodeService {
	@Resource
	private InviteCodeMapper inviteCodeMapper;

	@Override
	public void invoke(String invitecode, Long userid) {
		InviteCode code=inviteCodeMapper.selectByPrimaryKey(invitecode);
		if(code==null)
			 throw new ServiceException();
		code.setUserId(userid);
		inviteCodeMapper.updateByPrimaryKey(code);
	}

}

